﻿using System;
using System.Collections.Generic;

namespace ExChange.Web
{
    public class EnumHelper
    {
        public class EnumClass
        {
            public int Key { set; get; }
            public string Value { set; get; }
        }


        public static List<EnumClass> EnumToList<T>()
        {
            List<EnumClass> list = new List<EnumClass>();
            foreach (int i in Enum.GetValues(typeof(T)))
            {
                list.Add(new EnumClass()
                {
                    Key = i,
                    Value = Enum.GetName(typeof(T), i)
                });
            }
            return list;
        }

        public static Dictionary<int, string> EnumToDictionary<T>()
        {
            Dictionary<int, string> list = new Dictionary<int, string>();
            foreach (int i in Enum.GetValues(typeof(T)))
            {
                if (list.ContainsKey(i))
                    list[i] = Enum.GetName(typeof(T), i);
                else
                {
                    list.Add(i, Enum.GetName(typeof(T), i));
                }
            }
            return list;
        }


        /// <summary>
        /// 页面配置枚举
        /// </summary>
        public enum UploadType
        {
            欢迎页Logo = 1,
            欢迎页按钮 = 2,
            欢迎页欢迎图 = 3,
            页面颜色 = 4,
            欢迎语标题 = 5,
            欢迎语内容 = 6,
            欢迎语落款 = 7,
            欢迎内容类型 = 8,
            欢迎视频 = 9
        }

        /// <summary>
        /// 订单状态
        /// </summary>
        public enum OrderState
        {
            未发货 = 1,
            已发货 = 2
        }


        public enum Tongji
        {
            本周 = 1,
            本月 = 2,
            本年 = 3,

        }
    }
}
